package cn.kgc.boot.tcuser.service.impl;

import cn.kgc.boot.tcuser.entity.UploadFile;
import cn.kgc.boot.tcuser.mapper.UploadFileMapper;
import cn.kgc.boot.tcuser.service.UploadFileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author XMF
 * @date 2021-07-13 10:05
 **/
@Service
public class UploadFileServiceImpl implements UploadFileService {

    @Autowired
    private UploadFileMapper uploadFileMapper;

    @Override
    public List<UploadFile> queryAllUpLoadFile(String nameOrTitle) {
        List<UploadFile> uploadFiles = uploadFileMapper.queryAllUpLoadFile(nameOrTitle);
        return uploadFiles;
    }

    @Override
    public int updateDownloadCount(Integer fileId) {
        synchronized (UploadFileMapper.class){
            return uploadFileMapper.updateDownloadCount(fileId);
        }
    }
}
